package br.unifor.cct.mia.pso.coevolutionary;

import br.unifor.cct.mia.coevolution.CoevolutionaryDomain;
import br.unifor.cct.mia.dataenhancement.Database;
import br.unifor.cct.mia.dataenhancement.Structure;
import br.unifor.cct.mia.evolutionary.SpeciesConstants;
import br.unifor.cct.mia.pso.PSO;

public class CoevPSOFS extends PSO {

	private double minVal = 0;
	private double maxVal = 1;
	
	private static String[] configuracoes = {
		"br.unifor.cct.mia.initialize.PSOBasicRandonInitialize",
		"br.unifor.cct.mia.velocity.PSOSimpleVelocity",
		"br.unifor.cct.mia.coevolution.evaluate.PSOCoevolutionaryEvaluation"
	};	
	private Integer specieType = new Integer(SpeciesConstants.FEATURE_SELECTION);
	private CoevolutionaryDomain domain;
	
	public CoevPSOFS(Database dbOriginal, Structure structure, CoevolutionaryDomain domain, String[] options) {
    	super(structure.size()-1, configuracoes, options, false, true);
		System.out.println("[PSO COEV FS]Numero de atributos -> "+structure.size());
		this.dbOriginal = dbOriginal;
    	this.structure = structure;
    	this.domain = domain;
	}
	
	@Override
	public Object[] getObjectsEvaluate() {
		Object[] o =  new Object[5];
		o[0] = domain;
		o[1] = specieType;
		o[2] = structure;
		o[3] = dbOriginal;
		o[4] = this;
		return o;
	}

	@Override
	public Object[] getObjectsInitialize() {
		Object[] o =  new Object[4];
		o[0] = this.getConfigurations();
		o[1] = this.getPopulacao();
		o[2] = new Double(this.minVal);
		o[3] = new Double(this.maxVal);
		return o;
	}

	@Override
	public Object[] getObjectsVelocity() {
		Object[] o =  new Object[1];
		o[0] = this;
		return o;
	}

	@Override
	public void graphic() {
		domain.reloadGraphic(geracao,this);  	
	}
	
	public double getMinVal() {
		return minVal;
	}
	public void setMinVal(double minVal) {
		this.minVal = minVal;
	}
	public double getMaxVal() {
		return maxVal;
	}
	public void setMaxVal(double maxVal) {
		this.maxVal = maxVal;
	}
	public Integer getSpecieType() {
		return specieType;
	}
	public void setSpecieType(Integer specieType) {
		this.specieType = specieType;
	}
}
